#!/bin/bash

dir=$1
user=$2
if [ "${dir}" = "" ];
then
echo "Usage <dir>: Execute in a specified folder"
exit
fi

if [ "${user}" = "" ];
then
user=administrator
fi

echo "INFO: user as ${user}"

serverfile=${dir}/server.txt
sshkeyfile=${dir}/ssh_key
scriptfile=${dir}/map.sh
./map_servers.sh "${user}" "${serverfile}" "${dir}" "${scriptfile}" "${sshkeyfile}"

#execute the reduce program
./exec-red.sh "${dir}"